package main;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

public class LocalExecutor implements Executor {
	private ExecutorService executorService = Executors.newCachedThreadPool();

	@Override
	public boolean execute(Task task) {
		executorService.submit(task); // TODO check for consistency and return value
		return true;
	}
	
	@Override
	public void shutdown() {
		executorService.shutdown();
		try {
			executorService.awaitTermination(1, TimeUnit.DAYS);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}		
	}

}
